package net.xinqushi.io.input;



import java.io.ByteArrayOutputStream;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.ByteArrayInputStream;
import java.io.IOException;


public class BufferedInputStreamTest {

    public static void main(String[] args) throws IOException {
        ByteArrayInputStream bs = new ByteArrayInputStream("BufferedInputStreamTest".getBytes());

        BufferedInputStream bis = new BufferedInputStream(bs);// default cache 8KB data
        ByteArrayOutputStream bos = new ByteArrayOutputStream();

        for(int b = 0;( b = bis.read()) != -1;){
            bos.write(b);
        }
        System.out.println(new String(bos.toByteArray()));
    }
}
